Saturday, August 15, 2026

FBSimCity v0.9.0: the machine room — the real Firebird engine inside the explorable city

FBSimCity, the explorable isometric city of Firebird internals, is at v0.9.0 — and this one adds the thing the project has been circling since it started. The city has always carried the same caveat: it is a model, it parses no SQL, and no Firebird code runs in your browser. The new machine room is the other thing.

The machine room

The machine room runs the actual Firebird engine: version 6.0.0 of the embedded engine, compiled to WebAssembly by Electric Firebird the way PGlite does it for PostgreSQL, in a worker on the page. No server, nothing uploaded, and the database kept in IndexedDB so it survives a reload. On top of it sits a SQL workbench and six guided sequences, each one ending in a number you can hold against something the city draws:

  • SELECT CURRENT_TRANSACTION FROM RDB$DATABASE, twice — watch the id advance.
  • OIT, OAT and Next straight out of MON$DATABASE — the same three markers the city draws over the transaction yard.
  • Two UPDATEs to one row, then MON$RECORD_STATS back-version reads and purges — multi-generational architecture, counted by the engine.
  • RDB$RELATIONS — the catalogue is ordinary tables.
  • MON$IO_STATS fetches against reads — exactly what the cache plaza draws.
  • The MON$DATABASE settings list — no log setting in it, because there is no log.

Every verdict is computed from what the engine actually returned, so a sequence can tell you the answer was not what was expected. The page also states what the runtime cannot show: one attachment means there is no second session to queue behind, so no lock wait to watch; there is no replica; and gbak and nbackup are separate programs against a file that does not exist there.

A correction to v0.8.0

v0.8.0 shipped a page saying this embed was impossible, and it measured an iframe reporting not cross-origin isolated to prove it. The reasoning was right up to the last step. The engine is built with threads, so it needs SharedArrayBuffer, which browsers hand only to a cross-origin isolated page, and GitHub Pages will not send the COOP/COEP headers that grant isolation.

What I missed is that a service worker can synthesise those headers for any page that ships one — including this project's own — and that both projects publish to mariuz.github.io, so the engine's assets are same-origin and need no CORP header under require-corp. The old measurement was real. The iframe was not isolated because the page doing the framing was not isolated either, which was the part I never tested. The engine page now records the mistake rather than quietly dropping it.

Also in v0.9.0

  • The city used to load cold. Every cache slot empty, one version per tower, and the markers sitting exactly where they were initialised. It now warms 25 model seconds before the first frame. A database that has never run is not a neutral starting point — it is a state you will never meet.
  • Six touch and camera defects, found after reading how PGSimCity fixed the equivalent: pinch zoomed about the canvas origin instead of the fingers, two-finger pan was discarded entirely, a third finger landing jumped the city, touchcancel was unhandled, a pinch fought the camera fly-to, and keyboard +/ drifted the same way.
  • The readouts are now checked against the model behind them, and the throughput figure against independently counted completions. A gauge that wanders will happily paint a healthy city red.

And v0.8.0, for anyone who missed it

Keyboard navigation through every district — Tab and Shift+Tab walk them in pipeline order and announce each one through an aria-live region, which the city needed because it is a canvas and everything in it was mouse-only. Plus a fuzzer over 324 knob combinations, a soak, and enforced documentation coverage.

287 assertions, all passing. The suite runs in the browser with no framework and no build step: mariuz.github.io/FBSimCity/test/

City: mariuz.github.io/FBSimCity
Machine room: mariuz.github.io/FBSimCity/machine
Release notes: v0.9.0
Source: github.com/mariuz/FBSimCity (MIT, plain HTML/JS, no build step)

It remains a model for intuition, not an emulator. What is real, merely scaled, or a plausible stand-in is written down in the knob audit, along with the places the model is kinder than Firebird and the places it is harsher. Corrections are very welcome and do get acted on — the whole replication model was rewritten in v0.6.1 after Dmitry Sibiryakov pointed out on firebird-general that a synchronous replica which dies does not hang commits; it stops replicating and lets them through.

FBSimCity is an independent educational project, not affiliated with or endorsed by the Firebird Project. Firebird® is a registered trademark of the Firebird Foundation Incorporated.

No comments: